package com.tangzx.builder.abc;

import com.tangzx.builder.abc.string.MultiName;
import com.tangzx.builder.abc.string.QName;

public class ScriptInfo extends AbcElement {
	public int init_index;
	public Trait[] traits;
	
	public ScriptInfo(int init_index, Trait[] traits)
	{
		this.init_index = init_index;
		this.traits = traits;
	}
	
	@Override
	public void setCpool(AbcCPool pool) {
		super.setCpool(pool);
		for (Trait t : traits) {
			Metadata m = t.getMetadata("UnMix");
			if (m != null) {
				switch (t.getTag()) {
				case Trait.Trait_Class:
					MultiName mn = cpool.getMultiName(t.nameIndex);
					if (mn instanceof QName) {
						QName qname = (QName) mn;
						qname.getName().vo.setCanNotMix();
						//不混淆包名
						if (m.getValue("mixPackage").vo.getValue().equals("false")) {
							qname.getNameSpace().getString().vo.setCanNotMix();
							System.out.println("不混淆包名:" + qname.getNameSpace());
						}
					}
					break;
				}
			}
		}
	}
}
